$(document.html).addClass('js').removeClass('no-js');

window.addEvent('domready', function(j) {

    // Ajouts pour iOS
    ios_fixes();

    // Classes navigateur en JS
    clrz_body_class();

    // Scroll fluide
    initSmoothScroll('a[href^="#"], a.smooth-scroll');

    // Polyfill pour placeholder
    $$("input.clrz_placeholder, textarea.clrz_placeholder").each(function(e) {
        clrz_placeholder(e);
    });

    //  DÃ©commenter si commentaires avec enfants
    if ($('clrz_comment_parent') && $('txt_add_your_comment')) clrz_comments_parents();

    // DÃ©commenter si CLRZ Core : Suppression des erreurs au clic
    //    $$('.close_error').addEvent('click',function(){
    //        this.getParent().setStyle('display','none');
    //    })

    // Header fixed

    if($('share-fixed-single')) {
        var initScrollSingle = new scrollSingle();
    }

    window.addEvent('scroll', function() {
        scrollHeader();
    });

    scrollHeader();

    if ($$("#slider-footer__inner .slider-item").length > 5) {
        sliderFooter();
    }
    sliderRelated();
    sliderInstagram();
    sliderWishlist();

    loadmore();


    fixheader();


    fixsidebar();


    pinitimgs();


    new clrzLightBox($$('.boxlink'), {
        lightboxelements : [],
        islightboxmode : 0,
        maxlightboxelements : 0,
        actualelement : 0,
        prevelement : 0,
        nextelement : 0,
        elementFilter : 0,
        elementLightBoxSon : 0,
        elementLightBoxGranSon : 0,
        elementImg : 0,
        elementNext : 0,
        elementPrev : 0

    });

    // Force target="_blank" to comments links
    $$('.comment-content a').each(function(link) {
        if(link.get('target') !== '_blank')
            link.set('target', '_blank');
    });

});

var scrollHeader = function() {
    if ($('fixed-header')) {
        var topPosition = 150;
        if (window.getScroll().y - topPosition <= 0) {
            $('fixed-header').removeClass('is-visible');
        } else {
            $('fixed-header').addClass('is-visible');
        }

    }
}

window.addEvent('load', function(j) {
    // clrz_same_size('.samesize1, .samesize2');
});